<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>这里是主界面</h1>
<button onclick="tojoke()">通过ajax跳转到笑话界面</button>
<script th:src="@{/static/js/jquery.js}"></script>
<script>
    function tojoke() {
        $.ajax({
            type: "post",
            url: "./joke",
            dataType: "text",
            async: false,
            success: function () {
                alert("ajax跳转成功");
                window.location.href = "./tojoke"
            }
        })
    }
</script>
</body>
</html>